using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_prMap : EntityTypeConfiguration<so_pr>
    {
        public so_prMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Receipt__, t.DATE, t.Vendor, t.Local_Overhead, t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Receipt__)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.Order__)
                .HasMaxLength(8);

            this.Property(t => t.Vendor)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.Vendor__)
                .HasMaxLength(6);

            this.Property(t => t.Vendor_Invoice__)
                .HasMaxLength(8);

            this.Property(t => t.batch)
                .HasMaxLength(10);

            this.Property(t => t.currency)
                .HasMaxLength(5);

            this.Property(t => t.Shipment)
                .HasMaxLength(8);

            this.Property(t => t.season)
                .HasMaxLength(20);

            this.Property(t => t.Cash_VAT_Acct)
                .HasMaxLength(20);

            this.Property(t => t.Cost_Center)
                .HasMaxLength(20);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(131);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(27);

            // Table & Column Mappings
            this.ToTable("so_pr");
            this.Property(t => t.Receipt__).HasColumnName("Receipt_#");
            this.Property(t => t.Order__).HasColumnName("Order_#");
            this.Property(t => t.DATE).HasColumnName("DATE");
            this.Property(t => t.Vendor).HasColumnName("Vendor");
            this.Property(t => t.Vendor__).HasColumnName("Vendor_#");
            this.Property(t => t.Vendor_Invoice__).HasColumnName("Vendor_Invoice_#");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.Initial_Amount_Base1).HasColumnName("Initial_Amount_Base1");
            this.Property(t => t.Initial_Amount_Base2).HasColumnName("Initial_Amount_Base2");
            this.Property(t => t.DISCOUNT).HasColumnName("DISCOUNT");
            this.Property(t => t.Discount_percent).HasColumnName("Discount_percent");
            this.Property(t => t.Amount_After_Discount_B_1).HasColumnName("Amount_After_Discount_B_1");
            this.Property(t => t.Amount_After_Discount_B_2).HasColumnName("Amount_After_Discount_B_2");
            this.Property(t => t.Landed_cost_Base1).HasColumnName("Landed_cost_Base1");
            this.Property(t => t.Landed_cost_Base2).HasColumnName("Landed_cost_Base2");
            this.Property(t => t.Shipment).HasColumnName("Shipment");
            this.Property(t => t.Local_Overhead).HasColumnName("Local_Overhead");
            this.Property(t => t.Retail_margin).HasColumnName("Retail_margin");
            this.Property(t => t.Whole_margin).HasColumnName("Whole_margin");
            this.Property(t => t.All_OverHead_applied).HasColumnName("All_OverHead_applied");
            this.Property(t => t.CLOSED).HasColumnName("CLOSED");
            this.Property(t => t.Order_Closed).HasColumnName("Order_Closed");
            this.Property(t => t.Tax).HasColumnName("Tax");
            this.Property(t => t.season).HasColumnName("season");
            this.Property(t => t.Business_Unit).HasColumnName("Business_Unit");
            this.Property(t => t.COUNTRY).HasColumnName("COUNTRY");
            this.Property(t => t.Imported).HasColumnName("Imported");
            this.Property(t => t.Cash_VAT_Acct).HasColumnName("Cash_VAT_Acct");
            this.Property(t => t.Doc_date).HasColumnName("Doc_date");
            this.Property(t => t.Effective_date).HasColumnName("Effective_date");
            this.Property(t => t.Cost_Center).HasColumnName("Cost_Center");
            this.Property(t => t.Note).HasColumnName("Note");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
